#ifndef __CE_SCENE_ENTITYNODE_H__
#define __CE_SCENE_ENTITYNODE_H__

#include <export.h>
#include <gfx/enum.h>
#include <math/matrix.h>
#include <math/vector.h>
#include <scene/node.h>
#include <vector>

class ceGeometry;
class ceLightObject;
class ceCamera;
struct iAnimator;
struct iDevice;
struct iEffectCamera;
struct iTransformationCallback;

/**
 * \addtogroup scene
 * @{
 */

/**
 * @brief The extension of the ceNode can hold a ceGeometry, ceLightObject or a ceCamera
 */
class CE_API ceEntityNode : public ceNode
{
private:
	/**
	 * \name Attached Data
	 * @{
	 */
  ceGeometry*					_geometry;
  ceLightObject*      _light;
  ceCamera*						_camera;
	/**
	 * @}
	 */

  std::vector<iEffectCamera*> _effectCameras;
  bool                        _shouldRender;

	bool								_lit;
	ceLight*						_lights[MaxLights];
	unsigned						_numLights;

  bool                _castShadow;

protected:

  virtual void FillPrivateBoundingBox (ceBoundingBox& bbox);

  virtual void UpdateTransformation ();

public:
  ceEntityNode();
  virtual ~ceEntityNode();

  virtual ceNodeType GetNodeType() const;

  void AddEffectCamera (iEffectCamera* camera);
  unsigned GetNumberOfEffectCameras () const;
  iEffectCamera* GetEffectCamera (unsigned idx);
  const iEffectCamera* GetEffectCamera (unsigned idx) const;

  /**
   * \name Attached Data
   * @{
   */

  void SetGeometry (ceGeometry* geometry);
  ceGeometry* GetGeometry ();
  const ceGeometry* GetGeometry () const;

  void SetLight (ceLightObject* light);
  ceLightObject* GetLight ();
  const ceLightObject* GetLight () const;

  void SetCamera(ceCamera* camera);
  ceCamera* GetCamera ();
  const ceCamera* GetCamera () const;
  /**
   * @}
   */

	/**
	 * \name Lighting
	 * @{
	 */
	void SetLit (bool lit);
	bool IsLit () const;

	virtual void ClearLights ();
	virtual void AddLight (ceLight* light);
	ceLight* GetLight (unsigned idx) ;
	const ceLight* GetLight (unsigned idx) const;
	unsigned GetNumberOfLights () const;

  void SetCastShadow (bool castShadow);
  bool CastsShadow () const;
	/**
	 * @}
	 */


  void MarkForRendering (bool shouldRender);
  bool ShouldRender () const;

  virtual void Update(ceRenderEnvironment &env, iDevice* device);
	virtual void TestAndAddLight (ceLight* light);
  virtual void FindLights (ceSector* sector);
};


/** @} */

#endif /* ! __CE_SCENE_ENTITYNODE_H__ */

